#include "StdAfx.h"
#include "XMLLibrary.h"
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLException.hpp>
using namespace xercesc;

bool CXMLLibrary::s_IsInitialized = false;

CXMLLibrary::CXMLLibrary(void)
{
}


CXMLLibrary::~CXMLLibrary(void)
{
}

bool CXMLLibrary::Initializate(void)
{
	if (s_IsInitialized==false)
	{
		try {
			XMLPlatformUtils::Initialize();
			s_IsInitialized = true;
			return true;
		}
		catch (const XMLException&) {
			return false;
		}
	}
	else
	{
		return true;
	}
}

bool CXMLLibrary::IsInitializated(void)
{
	return s_IsInitialized;
}

bool CXMLLibrary::Terminate(void)
{
	if (s_IsInitialized==true)
	{
		XMLPlatformUtils::Terminate();
		return true;
	}
	else
	{
		return false;
	}
}